import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PlotInfoVO, PlotInfoForm, PlotInfoQuery } from '@/api/plotInfo/plotInfo/types';

/**
 * 查询地块查询列表
 * @param query
 * @returns {*}
 */

export const listPlotInfo = (query?: PlotInfoQuery): AxiosPromise<PlotInfoVO[]> => {
  return request({
    url: '/plotInfo/plotInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询地块查询详细
 * @param plotId
 */
export const getPlotInfo = (plotId: string | number): AxiosPromise<PlotInfoVO> => {
  return request({
    url: '/plotInfo/plotInfo/' + plotId,
    method: 'get'
  });
};

/**
 * 新增地块查询
 * @param data
 */
export const addPlotInfo = (data: PlotInfoForm) => {
  return request({
    url: '/plotInfo/plotInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改地块查询
 * @param data
 */
export const updatePlotInfo = (data: PlotInfoForm) => {
  return request({
    url: '/plotInfo/plotInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除地块查询
 * @param plotId
 */
export const delPlotInfo = (plotId: string | number | Array<string | number>) => {
  return request({
    url: '/plotInfo/plotInfo/' + plotId,
    method: 'delete'
  });
};
